home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_u_z / wshell11.zip / DLL.TXT < prev    next >
Text File  |  1991-11-19  |  3KB  |  61 lines

  1. INTERNAL COMMANDS DLL INTERFACE
  2.  
  3.  
  4. 1. OVERVIEW
  5.  
  6.     Each "Internal Command" is a DLL that contains the code for that 
  7. command.  The 'GENERIC.C' and associated files in the GENERIC directory 
  8. provide a template for creating a new Internal Command.  
  9.     An important consideration in implementing a new command is where to 
  10. store your data.  In order for your DLL to be completely reentrant, no variable can 
  11. be stored in the data segment.  That is, don't declare variables outside of a function, 
  12. and no static variables inside a function.  The reason for this is that each invocation 
  13. of a DLL function uses that same data segment.  If a DLL function was called 
  14. reentrantly,  static variables would be overwritten.  Thus, if a DLL requires more 
  15. data than will fit on the stack, use dynamic allocation.
  16.  
  17. 2. REQUIREMENTS
  18.  
  19. Each DLL must provide the following 3 functions for use by Windows Shell:
  20.  
  21. int FAR PASCAL ModuleProc (HWND hwndDisplay, int argc, LPSTR argv[]);
  22. @ ORDINAL 3
  23. hwndDisplay    - Window handle of STDIO Display to use for I/O.
  24. argc    - Number of command line arguments.
  25. argv    - Array of pointers to command line arguments.  The first pointer 
  26. always points to the name of the DLL.
  27.  
  28. This function is called to let the DLL do the function which it is providing.  For 
  29. example, if this were a DLL providing a file deletion function, the DLL would 
  30. perform the deletion at this time.
  31.  
  32. int FAR PASCAL ShowOptions (HWND hwndParent);
  33. @ ORDINAL 4
  34. This function is called to tell the DLL to show it's options box.  The DLL should 
  35. display a window which allows the user to set options in the DLL.
  36.  
  37. int FAR PASCAL ShowAbout (HWND hwndParent);
  38. @ ORDINAL 5
  39. This function is called to tell the DLL to show it's about box.  The DLL should 
  40. display an about window at this time.
  41.  
  42.  
  43.  
  44. NOTE - It is essential that the DLL export these functions at the specified ordinal 
  45. value in it's .DEF file.  Otherwise, The Windows Shell will not properly access the 
  46. DLL.
  47.  
  48. 3. USING THE DISPLAY
  49.  
  50. The header file 'wstdio.h' has been provided for outputing lines and other function 
  51. to the display.  The most common of these is dputs(), which you can use to output a 
  52. line to the display.  See the header file for the description of the rest of the 
  53. functions.
  54.  
  55. 4. UTILITY FUNCTIONS
  56.  
  57. The 'wslib.dll' provides several useful functions for parsing command lines, and 
  58. yielding to other applications.  It is extremely important that you use the 
  59. YieldToOthers() function your code sits in a tight loop for an extended length of 
  60. time.  See the header file 'wslib.h' for a list of useful functions.
  61.